package com.sdy.usercenter.biz.mapper;

import com.sdy.usercenter.biz.model.SysRoleResource;
import com.sdy.mvc.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 角色资源表 Mapper 接口
 * </p>
 *
 * @author zzq
 * @since 2019-06-14
 */
public interface SysRoleResourceMapper extends BaseMapper<SysRoleResource> {
    @ResultType(SysRoleResource.class)
    @Select("select a.* from sys_role_resource a " +
            "left join sys_resource b on b.id = a.resource_id " +
            "left join sys_role c on c.id = a.role_id " +
            "where b.id = ${resourceId} and b.state = 1 and c.state = 1")
    List<SysRoleResource> findRoleByResourceId(@Param("resourceId") Integer resourceId);
}
